<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>调用插件方法</title>
<script>
    async function myfunc() {
        var xx = await csobj.ExecMethodEx("Qins.Plugins.Hello.HelloPlugin", "sdfsdf")
        alert(xx);
    }
    function logfunc() {
        var xx = csobj_sync.ExecMethodandLog("Qins.Plugins.Hello.HelloPlugin", "sdfsdf", "testhello", "true")
        alert(xx);
    }
    function bengkui() {
        csobj.ExecMethodEx("Qins.Plugins.ThrowError.ThrowErrorPlugin","dfds")
    }
    function newfunc() {
        chrome.webview.addEventListener('message', event => alert(event.data));
        chrome.webview.postMessage('hello world')
    }
    function goToUrl() {
        var url = document.getElementById("url-input").value;
        window.location.href = url;
    }
    function goToByUrl(url) {
        window.location.href = url;
    }
    function goToXueXiUrl() {
        window.location.href = "https://jiaoyu.taobao.com/mine";
    }
    async function goToSetToken() {
        var tokenmsg = document.getElementById("settoken-input").value;
        var xx = await csobj.ExecMethodEx("HeiAisinoPlugins.HeiAisinoPlugin", tokenmsg);
        alert(xx);
    } 
    async function goToGetToken() {
        var tokenmsg = document.getElementById("gettoken-input").value;
        var xx = await csobj.ExecMethodEx("HeiAisinoPlugins.HeiAisinoPlugin", tokenmsg);
        alert(xx);
    } 
    </script>
    </head>
<body>
    <p>单击按钮触发函数。</p>
    <button onclick="myfunc()">点我</button>
    <button onclick="logfunc()">日志</button>
    <button onclick="bengkui()">bengkui</button>
    <button onclick="newfunc()">newfunc</button>
    <button onclick="bridge()">bridge</button>
    <label for="url-input">请输入网址：</label>
    <input type="text" id="url-input" name="url" value="http://localhost:44688/">
    <button onclick="goToUrl()">跳转</button>
    <button onclick="goToXueXiUrl()">跳转学习</button>
    <br />

    <button onclick="goToByUrl('https://hlin.aisino.com/jsjclient/Home/ReturnAisino?returnurl=http://www.baidu.com')">跳转到金税加</button>
    <!--<button onclick="goToByUrl('https://localhost:7202/Home/ReturnAisino?returnurl=http://www.baidu.com')">跳转到金税加</button>-->
    <input type="text" id="settoken-input" name="settoken" value="{'Type': 'settoken', 'Message': 'token'}">
    <button onclick="goToSetToken()">保存token</button>
    <input type="text" id="gettoken-input" name="gettoken" value="{'Type': 'gettoken', 'Message': 'token'}">
    <button onclick="goToGetToken()">获取token</button>
    <p id="demo"></p>
</body>
</html>